﻿@page "/"
@using NewLife.Serialization
@using Qing.Entity
<div class="main-wrapper" style="position: relative; top: -6vh;">
    <div class="container main-sentence justify-content-center text-center">
        @if (Topic == null)
        {

            <span id="sentence" style="font-size: 2rem;">暂无数据</span>
        }
        else
        {
            <span style="font-size: 1.2rem;">@Topic.Content</span>
            <div class="text-right mt-5 lead">
                @if (!Topic.Author.IsNullOrWhiteSpace())
                {
                    <p>作者：@Topic.Author</p>
                }
                @if (!Topic.Source.IsNullOrWhiteSpace())
                {
                    <p>来源：@Topic.Source</p>
                }
            </div>
        }
    </div>
</div>
<div class="foot-1" style="position: absolute; bottom: 7vh;width: 100%;">
    <div class="container">
        <div class="row">
            <div class="col text-center">
                <p class="lead ">截屏分享朋友</p>
                <p>
                    <img src="/qrcode.png" style="width: 128px; height: 128px;" />
                </p>
                <span class="btn btn-primary btn-filled btn-lg btn-block" style="max-width: 400px;" @onclick="RandomTopic">再来一个</span>
            </div>
        </div>
    </div>
</div>
@code
{
    public Topic Topic { get; private set; }

    public void RandomTopic()
    {
        this.Topic = Topic.Random();
    }

    protected override void OnInitialized()
    {
        RandomTopic();
        base.OnInitialized();
    }
}
